package com.lunhui.map.business.impl;

import com.alibaba.dubbo.common.logger.Logger;
import com.alibaba.dubbo.common.logger.LoggerFactory;
import com.lunhui.map.business.LunhuiMapService;
import com.lunhui.map.dal.dao.MapSourceDao;
import com.lunhui.map.dal.model.MapSource;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author renminghe-kg
 */
@Service("lunhuiMapService")
public class LunhuiMapServiceImpl implements LunhuiMapService {
    private static final Logger logger = LoggerFactory.getLogger(LunhuiMapServiceImpl.class);

    @Resource
    @Qualifier("lunHuiMapDao")
    private MapSourceDao lunHuiMapDao;


    @Override
    public List<MapSource> getMapInfo(int areaId, int sceneId) throws RuntimeException {

        List<MapSource> mapInfo;

        MapSource mapSource = new MapSource();
        mapSource.setAreaId(areaId);
        mapSource.setSceneId(sceneId);

        try {
            mapInfo = lunHuiMapDao.getMapInfo(mapSource);
        } catch (Exception e) {
            logger.error("获取地图数据失败: " + e.getMessage());

            throw new RuntimeException(e);
        }


        return mapInfo;
    }
}